-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exposing Create and CreateAsync in collection that takes variable number of Creatables #1015
Conversation
Can one of the admins verify this patch? |
I like it, but I'd like Jianghao to take a look as well. |
Looking good! It's cool that everyone gets the functionality for free. |
Thanks jianghao, yes there is one scenario where a collection that exposes public interface SupportsBatchCreation<ResourceT extends Resource> {
...
} |
@martinsawicki |
Also, one potential problem is for the async method. For sync methods, we have no problem calling: List<VirtualMachine> vms = virtualMachines.create(vm1, vm2); For async, this doesn't compile: ServiceCall<List<VirtualMachine>> vmsFuture = virtualMachines.createAsync(vm1, vm2, null); // BTW, let's consistently keep callback as the last param since it's optional
/* do a bunch of stuff here */
List<VirtualMachine> vms = vmsFuture.get(); |
The async issue seems more general [i.e. storing the return value of async with return type ServiceCall<List<VirtualNetworkInner>> list = this.innerCollection.listAllAsync(null); but not the below code, though List inherits from Collection ServiceCall<Collection<VirtualNetworkInner>> list1 = this.innerCollection.listAllAsync(null); [Below code compiles] ServiceCall<VirtualNetworkInner> v = this.innerCollection.getAsync(null, null, null); [below one not ] ServiceCall<com.microsoft.azure.Resource> v1 = this.innerCollection.getAsync(null, null, null);
|
@jianghaolu as far as the scenario question goes, the main thing I see with this is that I don't have to worry about asynch programming patterns to be able to take advantage of parallelism in the creation of independent resources. Our own automation test cases are a simple case of that --- to test aspects of an LB, a bunch of resources should already exist: VMs, PIPs, VNets. SO the test should pre-create them, but doing it all synchronously is very slow. Exposing this on a collection of specific resources is a step toward the even more flexible scenario I think we could fairly easily enable as well -- of accepting a list of arbitrary Creatables from the user (via e.g. Ultimately, I can easily envision users pursuing a pattern (in such more complex multi-resource situations) of not calling individual This could perhaps marry the best of both worlds - the intuitiveness, familiarity and debuggability of the imperative synchronous programming model with the performance of the declarative and asynchronous ARM template model. Just my thoughts on that. |
6c35000 Fix tests for fluent code a1cd0f1 Paging async works 148e463 Generate correct paging code 57cbe08 LRO tests pass bae30e0 Regenerate fluent 0882500 Merge commit '6eb93f97e4e2faab3b8e56090fc697c32dd2f410' into rx 2e44bb0 User observable for paging 0fffe57 Merge 9925f2c into da82c36 b7c1094 Remove unused imports b19b716 LRO now uses Rx 75a68c3 Generate Observable based clients in generic generator 0a7e455 Create VM works 5bb56b9 Fixing the javadoc error and formatting errors for key vault 16c5acd Observable based async works for NSG c039c6e Merge pull request Azure#1015 from anuchandy/resources-create 44a1519 Merge branch 'master' of github.com:Azure/azure-sdk-for-java into resources-create 652d622 Exposing Create and CreateAsync in collection that takes variable number of Creatables git-subtree-dir: runtimes git-subtree-split: 6c35000
Exposing Create and CreateAsync in collection that takes variable number of Creatables
6c35000 Fix tests for fluent code a1cd0f1 Paging async works 148e463 Generate correct paging code 57cbe08 LRO tests pass bae30e0 Regenerate fluent 0882500 Merge commit '6eb93f97e4e2faab3b8e56090fc697c32dd2f410' into rx 2e44bb0 User observable for paging 0fffe57 Merge 9925f2c into da82c36 b7c1094 Remove unused imports b19b716 LRO now uses Rx 75a68c3 Generate Observable based clients in generic generator 0a7e455 Create VM works 5bb56b9 Fixing the javadoc error and formatting errors for key vault 16c5acd Observable based async works for NSG c039c6e Merge pull request Azure#1015 from anuchandy/resources-create 44a1519 Merge branch 'master' of github.com:Azure/azure-sdk-for-java into resources-create 652d622 Exposing Create and CreateAsync in collection that takes variable number of Creatables git-subtree-dir: runtimes git-subtree-split: 6c35000
Exposing Create and CreateAsync in collection that takes variable number of Creatables
Exposing Create and CreateAsync in collection that takes variable number of Creatables
[Automatic PR] SDK changes from pull request Azure#1015
No description provided.